{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "52f51659-2232-433f-af28-d036a1e70ca5",
   "metadata": {},
   "outputs": [],
   "source": [
    "from selenium import webdriver\n",
    "from selenium.webdriver.common.by import By\n",
    "from selenium.webdriver.support.wait import WebDriverWait\n",
    "import time\n",
    "from lxml import etree\n",
    "import selenium\n",
    "import requests\n",
    "import os\n",
    "import os.path as osp"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "7167fe2e-6111-42fa-ad1c-a06a2de0ad24",
   "metadata": {},
   "outputs": [],
   "source": [
    "tar = 'https://www.huotuji.club/tools/%e5%be%ae%e5%af%86%e5%9c%88/page/{}'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "64097c0b-8f22-4e08-9af9-a27df8970343",
   "metadata": {},
   "outputs": [],
   "source": [
    "broser = webdriver.Edge()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "3abb3be7-559b-475a-8adb-67683ba32542",
   "metadata": {},
   "outputs": [],
   "source": [
    "broser.get(tar.format(2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "d4667e55-0762-42a2-8235-6ab9bdb525c2",
   "metadata": {},
   "outputs": [],
   "source": [
    "cookies = {\n",
    "    \"name\": \"aliyungf_tc\",\n",
    "    \"value\": \"9d28d1772bf0038567a5c6d749896d44f20430ecbae1c1ff944ad703551d66eb\"\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "b1a0f99e-b072-4e09-b18c-196b8ae3e571",
   "metadata": {},
   "outputs": [],
   "source": [
    "broser.get(href[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "2651c9ce-d1db-4cdb-b384-5b9a91f291d5",
   "metadata": {},
   "outputs": [],
   "source": [
    "broser.add_cookie(cookies)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "43d8f9aa-d1f0-4fb3-8cec-f2871a8c44f5",
   "metadata": {},
   "outputs": [],
   "source": [
    "url_file = []"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "id": "c63dcdb4-2e34-45cf-83d9-93f1325f1044",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3\n"
     ]
    }
   ],
   "source": [
    "for i in range(10, 89):\n",
    "    broser.get(tar.format(i))\n",
    "    time.sleep(3)\n",
    "    broser.execute_script('window.scrollBy(0,1800)')\n",
    "    time.sleep(3)\n",
    "    href = [tagA.get_attribute('href') for tagA in broser.find_elements(By.XPATH, '//img[@class=\" lazyloaded\"]/parent::*')]\n",
    "    print(len(href))\n",
    "    if(len(href) < 12):\n",
    "        break\n",
    "    for url in href:\n",
    "        broser.get(url)\n",
    "        broser.implicitly_wait(3)\n",
    "        data_url = broser.find_element(By.XPATH, '//div[@class=\"content-hide-tips\"]').text.split('\\n')[0]\n",
    "        url_file.append(data_url)\n",
    "        # broser.get(data_url)\n",
    "        # broser.implicitly_wait(3)\n",
    "        # broser.find_element(By.CLASS_NAME, 'text').click() \n",
    "        # broser.find_elements(By.CLASS_NAME, 'td-tree-node__label')[1].click()\n",
    "        # broser.find_element(By.XPATH, '//div[@class=\"file-tree-btn__normal\"]/a[1]').click()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "0f5fa05d-01c4-4d03-9398-040f74a360e4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['https://pan.xunlei.com/s/VNlHjoSpEoKT3qr4EFCWoamqA1?pwd=s7pc#',\n",
       " 'https://pan.xunlei.com/s/VNlHjPTbTPtZDWtQhjVOyS7BA1?pwd=pgwa#',\n",
       " 'https://pan.xunlei.com/s/VNlHj-naqfM-Ga2_IXF79d5WA1?pwd=ik3z#',\n",
       " 'https://pan.xunlei.com/s/VNlHieCliDBgZ7QxwsdrEe2UA1?pwd=bbyf#',\n",
       " 'https://pan.xunlei.com/s/VNlHiEdvy0a3E5JNm60aZbeNA1?pwd=e3ha#',\n",
       " 'https://pan.xunlei.com/s/VNlHhaElEoKT3qr4EFCWo0V4A1?pwd=w3sx#',\n",
       " 'https://pan.xunlei.com/s/VNl7A6jkKcBzM9Z31eXeU9jxA1?pwd=6pjz#',\n",
       " 'https://pan.xunlei.com/s/VNl79ghKMDpxOhL6AldFumkNA1?pwd=aq3z#',\n",
       " 'https://pan.xunlei.com/s/VNl79Jb49AKHC4n00WC5n0zPA1?pwd=n5u9#',\n",
       " 'https://pan.xunlei.com/s/VNl78vpPy0a3E5JNm60YX2ZTA1?pwd=5cxj#',\n",
       " 'https://pan.xunlei.com/s/VNl78VIJrTrE5boA_o1nX4nyA1?pwd=qxhy#',\n",
       " 'https://pan.xunlei.com/s/VNl77wRg9AKHC4n00WC5m_npA1?pwd=kk5v#',\n",
       " 'https://pan.xunlei.com/s/VNkxfpOddMAvWLmyFxiZkE-lA1?pwd=t879#',\n",
       " 'https://pan.xunlei.com/s/VNkxfU_34L1w2wwkuXXpscByA1?pwd=j9zm#',\n",
       " 'https://pan.xunlei.com/s/VNkxf9enpPLcAs16QNERGP_PA1?pwd=bd9q#',\n",
       " 'https://pan.xunlei.com/s/VNkxem0TrmlYQebiu7bsUTirA1?pwd=dzce#',\n",
       " 'https://pan.xunlei.com/s/VNkxeKFL7dBkxqwybXZa4BKDA1?pwd=j7e4#',\n",
       " 'https://pan.xunlei.com/s/VNkxdqZ16S54NAsle2L5GHZzA1?pwd=m4gj#',\n",
       " 'https://pan.xunlei.com/s/VNknOir7NnZ_LKXDsb0LB5AMA1?pwd=ux6u#',\n",
       " 'https://pan.xunlei.com/s/VNknOO1SrKkeSrLbxU8w1OOCA1?pwd=5dyj#',\n",
       " 'https://pan.xunlei.com/s/VNknO-eP5hsK9ZJLN04oInYSA1?pwd=3wpb#',\n",
       " 'https://pan.xunlei.com/s/VNknNbvV5Qsi5TgKplY9xifLA1?pwd=6mty#',\n",
       " 'https://pan.xunlei.com/s/VNknNBe6J99pxI6PRGav2W4iA1?pwd=3p3f#',\n",
       " 'https://pan.xunlei.com/s/VNknMkDGoL81QGQPzafxglNSA1?pwd=i42k#',\n",
       " 'https://pan.xunlei.com/s/VNkd6EL8e_HLTC1ibgeF-G73A1?pwd=9ptm#',\n",
       " 'https://pan.xunlei.com/s/VNkd5u60WvCI7eihUwFhWCo3A1?pwd=3vdj#',\n",
       " 'https://pan.xunlei.com/s/VNkd5TPnWvCI7eihUwFhW4lAA1?pwd=uve5#',\n",
       " 'https://pan.xunlei.com/s/VNkd56x52zSBgBhsc1VbFeALA1?pwd=jryz#',\n",
       " 'https://pan.xunlei.com/s/VNkd4kY07IQKTLgdhgHGWo6FA1?pwd=vd33#',\n",
       " 'https://pan.xunlei.com/s/VNkd4O2rGZbR096CLZG4fVSGA1?pwd=5raf#',\n",
       " 'https://pan.xunlei.com/s/VNkTtpwJyQL3R-ijsO6Ij_h2A1?pwd=hgws#',\n",
       " 'https://pan.xunlei.com/s/VNkTtTkGrNJ235hkHSuG7OpGA1?pwd=piay#',\n",
       " 'https://pan.xunlei.com/s/VNkTt5OqrNJ235hkHSuG7I-zA1?pwd=cqke#',\n",
       " 'https://pan.xunlei.com/s/VNkTsgKq5HaKpo0U7P1JUfJwA1?pwd=rz6s#',\n",
       " 'https://pan.xunlei.com/s/VNkTsKojaVoCnXbldKPIoPM6A1?pwd=dpgr#',\n",
       " 'https://pan.xunlei.com/s/VNkTrwxz3z4CewPp0alqKDTUA1?pwd=wawt#',\n",
       " 'https://pan.xunlei.com/s/VNkJT38gUkGQ_1nr9A8BvUg3A1?pwd=a9cv#',\n",
       " 'https://pan.xunlei.com/s/VNkJShnMiYxKx1-gQGA2CQBhA1?pwd=rrrz#',\n",
       " 'https://pan.xunlei.com/s/VNkJSIjXPUtTY9X4quPDnbrpA1?pwd=xiik#',\n",
       " 'https://pan.xunlei.com/s/VNkJRuJd0nCBXRhZm4jwdEwAA1?pwd=k7eh#',\n",
       " 'https://pan.xunlei.com/s/VNkJRSYYqRCgaUHorkUD6ltUA1?pwd=cne9#',\n",
       " 'https://pan.xunlei.com/s/VNkJR1uvzZjXD6jsHbxU9D15A1?pwd=zn24#',\n",
       " 'https://pan.xunlei.com/s/VNk93I3cAkk-pyFa62I0n5lQA1?pwd=ee42#',\n",
       " 'https://pan.xunlei.com/s/VNk92vBRrarbyd44WaKT0O2bA1?pwd=swf5#',\n",
       " 'https://pan.xunlei.com/s/VNk92ZY2rFnVHwWuCCLQpumKA1?pwd=wnda#',\n",
       " 'https://pan.xunlei.com/s/VNk92BdKkV5NI081hQJpXOGeA1?pwd=th82#',\n",
       " 'https://pan.xunlei.com/s/VNk91oSpYBdNLVPygr-cuGWMA1?pwd=mnfd#',\n",
       " 'https://pan.xunlei.com/s/VNk91MFtBI5qEBkDv3taxJdsA1?pwd=st9t#',\n",
       " 'https://pan.xunlei.com/s/VNjzqnIdAkk-pyFa62Hyqm0VA1?pwd=4mfb#',\n",
       " 'https://pan.xunlei.com/s/VNjzqG8o8TLSjRuHEHUUEBbGA1?pwd=dnyy#',\n",
       " 'https://pan.xunlei.com/s/VNjzpn3zYyoXEyLh4snccQStA1?pwd=hshg#',\n",
       " 'https://pan.xunlei.com/s/VNjzpNxI1jRh0SMFpMOPcgDJA1?pwd=hk3x#',\n",
       " 'https://pan.xunlei.com/s/VNjzotooA5ZEMEIATMgbZKRnA1?pwd=cidi#',\n",
       " 'https://pan.xunlei.com/s/VNjzoI_ONXDdeNQ9pAxRZuavA1?pwd=ktkf#',\n",
       " 'https://pan.xunlei.com/s/VNjpcQe1euipkA_oOQ4r0NuQA1?pwd=cgp2#',\n",
       " 'https://pan.xunlei.com/s/VNjpbyvxm3G-4qO7aS94m-WVA1?pwd=mvm5#',\n",
       " 'https://pan.xunlei.com/s/VNjpb_q_U6GvaXkE39nmvf1WA1?pwd=suvm#',\n",
       " 'https://pan.xunlei.com/s/VNjpbEc9dtM6wmdAIB4hezzNA1?pwd=cce7#',\n",
       " 'https://pan.xunlei.com/s/VNjpaeSU1zSXvG-1ClYFOjxjA1?pwd=k8tj#',\n",
       " 'https://pan.xunlei.com/s/VNjpaDnxGW45wUYGnDQt5oXnA1?pwd=8f22#',\n",
       " 'https://pan.xunlei.com/s/VNjf2kaGKRgBoiWoFsE-sDruA1?pwd=q53p#',\n",
       " 'https://pan.xunlei.com/s/VNjf2KKpPxivosg_dr-j2henA1?pwd=3njq#',\n",
       " 'https://pan.xunlei.com/s/VNjf1wtLWiASah4d0Ckld09hA1?pwd=qukc#',\n",
       " 'https://pan.xunlei.com/s/VNjf1RNrkRVqXjuzs8v7wjGfA1?pwd=9t5v#',\n",
       " 'https://pan.xunlei.com/s/VNjf11O7KRgBoiWoFsE-rhwaA1?pwd=2tdg#',\n",
       " 'https://pan.xunlei.com/s/VNjf0_D5Pxivosg_dr-j2EAkA1?pwd=vh3r#',\n",
       " 'https://pan.xunlei.com/s/VNjVxap0Vv0XraQqOTCrm87YA1?pwd=pc2a#',\n",
       " 'https://pan.xunlei.com/s/VNjVx1oatMwi5ioZ0Wp3FgCiA1?pwd=pm7g#',\n",
       " 'https://pan.xunlei.com/s/VNjVwYzptMwi5ioZ0Wp3FWSoA1?pwd=ewk6#',\n",
       " 'https://pan.xunlei.com/s/VNjVvzZ-WiASah4d0Ckijy1eA1?pwd=nyfi#',\n",
       " 'https://pan.xunlei.com/s/VNjVvX3_Kz74On4RuFk08jdAA1?pwd=agf7#',\n",
       " 'https://pan.xunlei.com/s/VNjVupl1JFw9ej6eoW_kJJcXA1?pwd=t5s7#',\n",
       " 'https://pan.xunlei.com/s/VNjLVAJ2AF1hiPcLwP5OCMnPA1?pwd=xn9n#',\n",
       " 'https://pan.xunlei.com/s/VNjLUnjR0xwxvbpUyndDvv3WA1?pwd=sufk#',\n",
       " 'https://pan.xunlei.com/s/VNjLUP57-erouKKd4UhMw6AQA1?pwd=tux5#',\n",
       " 'https://pan.xunlei.com/s/VNjLTvOUsY5NMKNzxzqFchrKA1?pwd=7trg#',\n",
       " 'https://pan.xunlei.com/s/VNjLTVLjmKq_i0yA8trNucuqA1?pwd=z4rn#',\n",
       " 'https://pan.xunlei.com/s/VNjLT4inAF1hiPcLwP5OBPUIA1?pwd=t8de#',\n",
       " 'https://pan.xunlei.com/s/VNjBPpo_Gfq-DFsThlpWzk4gA1?pwd=e8je#',\n",
       " 'https://pan.xunlei.com/s/VNjBPURUwDtzKiR4q68jQtmcA1?pwd=kvsd#',\n",
       " 'https://pan.xunlei.com/s/VNjBP7OECD7Au7i79Ri10nN4A1?pwd=4ekz#',\n",
       " 'https://pan.xunlei.com/s/VNjBOgb-YITlkZZbwvA_v5eFA1?pwd=6ht6#',\n",
       " 'https://pan.xunlei.com/s/VNjBOGG0690lEoj-mJbqq11YA1?pwd=kuv7#',\n",
       " 'https://pan.xunlei.com/s/VNjBNne3EqMkWRKW7TzIgYZdA1?pwd=epen#',\n",
       " 'https://pan.xunlei.com/s/VNj0z8xN3l-qwTpE0A5UfG2kA1?pwd=jy8b#',\n",
       " 'https://pan.xunlei.com/s/VNj0ymOkplae0wOKNO1GCB2YA1?pwd=75af#',\n",
       " 'https://pan.xunlei.com/s/VNj0yPRDENvE7feIuDHVcmHoA1?pwd=2z4g#',\n",
       " 'https://pan.xunlei.com/s/VNj0xzMPN7uKdUQkrMaGY3TsA1?pwd=ztbv#',\n",
       " 'https://pan.xunlei.com/s/VNj0x_FOU62dfUaWt3UL-NFTA1?pwd=hdik#',\n",
       " 'https://pan.xunlei.com/s/VNj0xCGDJ651huaOAxVWEg_YA1?pwd=hwrp#',\n",
       " 'https://pan.xunlei.com/s/VNirla2bB_jj6Pqv-MDyoLF4A1?pwd=arp3#',\n",
       " 'https://pan.xunlei.com/s/VNirkx3OrTSsA2WjgNicetqeA1?pwd=wgmw#',\n",
       " 'https://pan.xunlei.com/s/VNirkXjUV4T4uHTDAjp18TeoA1?pwd=x7ua#',\n",
       " 'https://pan.xunlei.com/s/VNirk9zXGLxiBh2ZTQ0hQDGsA1?pwd=4vmf#',\n",
       " 'https://pan.xunlei.com/s/VNirjeuUPzXH88rhrkQCNM_EA1?pwd=rnhs#',\n",
       " 'https://pan.xunlei.com/s/VNirjGI6vMqAv6czmsIqoKs0A1?pwd=73bj#',\n",
       " 'https://pan.xunlei.com/s/VNihcuRpF3zARBaesTnmazQdA1?pwd=pbz2#',\n",
       " 'https://pan.xunlei.com/s/VNihc_1J8BKE25s1Wl22f9MTA1?pwd=gnve#',\n",
       " 'https://pan.xunlei.com/s/VNihcE3ejXKcsaNQPm86-tjlA1?pwd=kxw3#',\n",
       " 'https://pan.xunlei.com/s/VNihbrVoBOrvrMFO_NBkwU7nA1?pwd=3u4a#',\n",
       " 'https://pan.xunlei.com/s/VNihbUiWh-EtL7qYb8tZMCQ8A1?pwd=fu55#',\n",
       " 'https://pan.xunlei.com/s/VNihb8-UC4YcjlNblt-8igsFA1?pwd=gz2v#',\n",
       " 'https://pan.xunlei.com/s/VNiY-0UmOp5gDFtz2NW4LJeIA1?pwd=t4qb#',\n",
       " 'https://pan.xunlei.com/s/VNiXzX-83E8oobCwZ_YwQpTlA1?pwd=yc9a#',\n",
       " 'https://pan.xunlei.com/s/VNiXz68WtfbtX00BxHznj_dmA1?pwd=hzz7#',\n",
       " 'https://pan.xunlei.com/s/VNiXyfOryl44NBoaB_duuORrA1?pwd=nrjh#',\n",
       " 'https://pan.xunlei.com/s/VNiXyJU69NPrEr9nzanwn6BnA1?pwd=ehqm#',\n",
       " 'https://pan.xunlei.com/s/VNiXxtJoi4gqEIIBrTLqc-HsA1?pwd=r964#',\n",
       " 'https://pan.xunlei.com/s/VNiIwmniydoXy61L6Qf_O2KuA1?pwd=vrg6#',\n",
       " 'https://pan.xunlei.com/s/VNiIxA6PGvwBcF9SX_24rPS2A1?pwd=84q9#',\n",
       " 'https://pan.xunlei.com/s/VNiIxKgYpNn8RnakA1KCnwJ3A1?pwd=a2yg#',\n",
       " 'https://pan.xunlei.com/s/VNiIxX68Jwmbk0_fg-I8LwnQA1?pwd=q7xp#',\n",
       " 'https://pan.xunlei.com/s/VNiIxhrIGvwBcF9SX_24rjjQA1?pwd=mp3k#',\n",
       " 'https://pan.xunlei.com/s/VNiIxtLNUcl-q2NYz6kCFgkWA1?pwd=cm22#',\n",
       " 'https://pan.quark.cn/s/ab61731dfc4a',\n",
       " 'https://pan.quark.cn/s/d0f4cc3df52b',\n",
       " 'https://pan.quark.cn/s/d6d69897178e',\n",
       " 'https://pan.quark.cn/s/e4ba720c7f7f',\n",
       " 'https://pan.quark.cn/s/f138a897ec8a',\n",
       " 'https://pan.quark.cn/s/baabfc9ae680',\n",
       " 'https://pan.quark.cn/s/2a1a4ac45e42',\n",
       " 'https://pan.quark.cn/s/1f28e86633cd',\n",
       " 'https://pan.quark.cn/s/22f708995e6e',\n",
       " 'https://pan.quark.cn/s/c6d5215d8b56',\n",
       " 'https://pan.quark.cn/s/f1a54447d915',\n",
       " 'https://pan.quark.cn/s/a1ecb89e819e',\n",
       " 'https://pan.quark.cn/s/6ff1c1a3f5e7',\n",
       " 'https://pan.quark.cn/s/ec11263179cb',\n",
       " 'https://pan.quark.cn/s/c9f1e72533cc',\n",
       " 'https://pan.quark.cn/s/d89151bf7b1b',\n",
       " 'https://pan.quark.cn/s/a11e1d04bff9',\n",
       " 'https://pan.quark.cn/s/48a7ac0adbd1']"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "url_file"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "23aaebb1-b6bb-48ef-befc-46754799b68c",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
